#include <nios2_led.h>
#include <system.h>

volatile alt_u8 led_value;

static void
led_show() {
    __builtin_stwio (((void *)((unsigned*)(0xc0000000 + PIO_LED_BASE))), (led_value));
}

void
led(alt_u8 value) {
    led_value = value;
    led_show();
}

void
led_next() {
    led_value++;
    led_show();
}
